package cn.bluethink.eguan.core.entity;

import java.io.Serializable;
import java.util.Date;

import cn.bluethink.eguan.model.core.EgComment;
import cn.bluethink.eguan.model.core.EgOType;
import cn.bluethink.eguan.model.core.EgObject;
import cn.bluethink.eguan.model.core.EgUser;

public class CommentEntity implements Serializable{

	private static final long serialVersionUID = -7788254298176904345L;

	private Long cmid;
	
	private String content;
	
	private Integer otype;
	
	private Long oid;
	
	private Long uid;
	
	/**
	 * 如果被评论对象是评论，该字段为该对象的评论者Id
	 */
	private Long commentator;
	
	/**
	 * 评论者name
	 */
	private String comname;
	
	private Date utime;
	
	private Integer checkStatus;
	
	private String uname;
	
	private String avator;

	/**
	 * 累计被吐槽或评论次数
	 */
	private Integer count;
	
	public EgComment createComment() {
		EgComment comment = new EgComment();
		comment.setId(cmid);
		comment.setName(content);

		EgObject obj = null;
		if(oid > 0 && otype > 0) {
			EgOType type = new EgOType(otype, null);
			obj = new EgObject(oid, null, type);
		}
		comment.setObj(obj);
		
		EgUser user = new EgUser(uid, uname, avator);
		comment.setUser(user);
		
		if(commentator == null) commentator = 0L;
		EgUser comuser = new EgUser(commentator, comname, null);
		comment.setCommentator(comuser);
		
		comment.setTime(utime);
		comment.setCount(count);
		comment.setCheckStatus(checkStatus);
		return comment;
	}
	
	public Long getCmid() {
		return cmid;
	}

	public void setCmid(Long cmid) {
		this.cmid = cmid;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Integer getOtype() {
		return otype;
	}

	public void setOtype(Integer otype) {
		this.otype = otype;
	}

	public Long getOid() {
		return oid;
	}

	public void setOid(Long oid) {
		this.oid = oid;
	}

	public Long getUid() {
		return uid;
	}

	public void setUid(Long uid) {
		this.uid = uid;
	}

	public Date getUtime() {
		return utime;
	}

	public void setUtime(Date utime) {
		this.utime = utime;
	}

	public Integer getCheckStatus() {
		return checkStatus;
	}

	public void setCheckStatus(Integer checkStatus) {
		this.checkStatus = checkStatus;
	}

	public String getUname() {
		return uname;
	}

	public void setUname(String uname) {
		this.uname = uname;
	}

	public String getAvator() {
		return avator;
	}

	public void setAvator(String avator) {
		this.avator = avator;
	}

	public Integer getCount() {
		return count;
	}

	public void setCount(Integer count) {
		this.count = count;
	}

	public Long getCommentator() {
		return commentator;
	}

	public void setCommentator(Long commentator) {
		this.commentator = commentator;
	}

	public String getComname() {
		return comname;
	}

	public void setComname(String comname) {
		this.comname = comname;
	}
	
	
}
